﻿// ———————————————————————–
// <copyright file="IContentCache.cs" company="The MITRE Corporation">
//    Copyright (c) 2010 The MITRE Corporation. All rights reserved.
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//    http://www.apache.org/licenses/LICENSE-2.0
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
// </copyright>
// ———————————————————————–
/////////////////////////////////////////////////////////////////////////////////////////////////
// IContentCache.cs - 
// Project: "ICNETDAL"
//
// Language:    C#, .NET 4.0
// Platform:    Windows 7, VS 2010
// Author:      Don McGarry The MITRE Corporation
/////////////////////////////////////////////////////////////////////////////////////////////////

// Copyright (c) 2010 The MITRE Corporation. All rights reserved.
//
// NOTICE
// This software was produced for the U. S. Government
// under Contract No. FA8721-09-C-0001, and is
// subject to the Rights in Noncommercial Computer Software
// and Noncommercial Computer Software Documentation Clause
// (DFARS) 252.227-7014 (JUN 1995)

using System;
using EDXLSharp.EDXLDELib;

namespace ICNETDAL
{
  /// <summary>
  /// The interface for a ContentCache implementation
  /// </summary>
  public interface IContentCache
  {
    /// <summary>
    /// Gets all KML
    /// </summary>
    /// <returns>All KML</returns>
    string GetAllKML();

    /// <summary>
    /// Gets the currently active KML
    /// </summary>
    /// <returns>Currently active KML</returns>
    string GetActiveKML();

    /// <summary>
    /// Gets the expired KML
    /// </summary>
    /// <returns>Expired KML</returns>
    string GetExpiredKML();

    /// <summary>
    /// Gets all KML that has been updated since the specified time
    /// </summary>
    /// <param name="since">The cutoff for updates</param>
    /// <returns>Updated KML since the specified time</returns>
    string GetUpdatedKML(DateTime since);

    string GetActiveKMLByRole(string role, string roleURI);

    string GetExpiredKMLByRole(string role, string roleURI);

    string GetUpdatedKMLByRole(DateTime since, string role, string roleURI);

    /// <summary>
    /// Gets all XML
    /// </summary>
    /// <returns>All XML</returns>
    string GetAllXML();

    /// <summary>
    /// Gets the currently active XML
    /// </summary>
    /// <returns>Currently active XML</returns>
    string GetActiveXML();

    string GetActiveXMLByRole(string role, string roleURI);

    /// <summary>
    /// Gets all DELink
    /// </summary>
    /// <returns>All DELink</returns>
    string GetAllDELink();

    /// <summary>
    /// Gets the currently active DELink
    /// </summary>
    /// <returns>Currently active DELink</returns>
    string GetActiveDELink();

    /// <summary>
    /// Gets the expired DELink
    /// </summary>
    /// <returns>Expired DELinkL</returns>
    string GetExpiredDELink();

    /// <summary>
    /// Gets all DELink that has been updated since the specified time
    /// </summary>
    /// <param name="since">The cutoff for updates</param>
    /// <returns>Updated KML since the specified time</returns>
    string GetUpdatedDELink(DateTime since);

    string GetActiveDELinkByRole(string role, string roleURI);

    string GetExpiredDELinkByRole(string role, string roleURI);

    string GetUpdatedDELinkByRole(DateTime since, string role, string roleURI);



    /// <summary>
    /// Gets the XML representation of a ContentObject.
    /// </summary>
    /// <param name="contentHash">The hash of the content object to retrieve.</param>
    /// <returns>String of XML content to return to the user.</returns>
    string GetContentObjectByContentHash(int contentHash);

    /// <summary>
    /// Gets the KML representation of a ContentObject.
    /// </summary>
    /// <param name="contentHash">The hash of the content object to retrieve.</param>
    /// <returns>String of KML content to return to the user.</returns>
    string GetKMLByContentHash(int contentHash);

    /// <summary>
    /// Gets the GeoRSS representation of a ContentObject.
    /// </summary>
    /// <param name="contentHash">The hash of the content object to retrieve.</param>
    /// <returns>String of GeoRSS content to return to the user.</returns>
    string GetGeoRSSByContentHash(int contentHash);

    /// <summary>
    /// Gets the HTML representation of a ContentObject.
    /// </summary>
    /// <param name="contentHash">The hash of the content object to retrieve.</param>
    /// <returns>String of HTML content to return to the user.</returns>
    string GetHTMLByContentHash(int contentHash);

    /// <summary>
    /// Deletes cached content with the provided Sender ID and Distribution ID
    /// </summary>
    /// <param name="senderId">The DE SenderID</param>
    /// <param name="distributionId">The DE DistributionID</param>
    void DeleteContent(string senderId, string distributionId);

    /// <summary>
    /// Deletes cached content with the provided Content Hash
    /// </summary>
    /// <param name="contentHash">The content hash</param>
    void DeleteContent(string contentHash);

    /// <summary>
    /// Adds content objects to the content cache, or updates existing entries
    /// </summary>
    /// <param name="de">DE containing the content objects</param>
    void AddAndUpdateContent(EDXLDE distribution);
  }
}